Conversation
This PR uses the new `loadFormat` option for IPLD to lazily require IPLD formats in order to reduce the startup time for the node. If you're feeling like you've seen this before then, for reference: The PR ipld/js-ipld#164 undid the work done in ipld/js-ipld#145 and ipld/js-ipld#178 re-enabled lazy loading. License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
|
Merging as the failures are because of an unrelated libp2p issue |
|
Love this, +1, but we should maybe start another thread about trying to make this work with code splitting in webpack as well. Getting these out of bundles would be a big win :) |
|
Can we go even one more lever deeper in the lazyness and make the formats loaded through IPFS if the node gets a CID for which it doesn't have the IPLD Format code yet? |
|
@diasdavid that should be how this works :) All the imports are in getters, so they won't be called until we get a request for a codec, which should only happen if we're working with a block that is using that codec. |
|
I mean, not even bundle it. Fetch the code from IPFS while the node is already running :D |
❤️ YES 🤯 IPFS module loader? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports //cc @achingbrain |
This PR uses the new
loadFormatoption for IPLD to lazily require IPLD formats in order to reduce the startup time for the node.If you're feeling like you've seen this before then, for reference:
The PR ipld/js-ipld#164 undid the work done in ipld/js-ipld#145 and ipld/js-ipld#178 re-enabled the ability to do so. This PR makes use of this new ability to lazy load the formats.